package cc.ls51.api.controller;

import cc.ls51.form.UserLoginForm;
import cc.ls51.modules.SysUser.entity.SysUser;
import cc.ls51.modules.SysUser.service.ISysUserService;
import cc.ls51.vo.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author llf
 * @since 2019-08-27
 */
@Controller
public class IndexController {

    @Autowired
    ISysUserService sysUserService;

    @RequestMapping("/")
    @ResponseBody
    public ResultObject index(){
        SysUser user = sysUserService.selectById(1L);
        return ResultObject.ok("api").put("user",user);
    }

    @PostMapping(value = "/postLogin")
    @ResponseBody
    public ResultObject postLogin(UserLoginForm form) {
        ResultObject ro = ResultObject.ok();
        return ro;
    }
}
